home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / sviluppo / svilupp2 / gmsppr10.lha / mylib / PError.c < prev    next >
C/C++ Source or Header  |  1995-12-10  |  996b  |  45 lines

  1. #include "MyLib.h"
  2.  
  3. /****** MyLib.lib/PError *************************************************
  4. *
  5. *    NAME
  6. *    PError -- output a dos error message
  7. *
  8. *    SYNOPSIS
  9. *    PError(ErrorCode, Header)
  10. *
  11. *    void PError(LONG, const char *);
  12. *
  13. *    FUNCTION
  14. *    This function works like dos.library/PrintFault(), except that
  15. *    it outputs to StdErr.
  16. *
  17. *    INPUTS
  18. *    ErrorCode - the error code representing the error.
  19. *                0 will cause IoErr() to be used instead.
  20. *    Header    - an optional header
  21. *
  22. *    NOTE
  23. *    This function calls ErrorHandle(), which means you will have
  24. *    an initialized StdErr stream afterwards.
  25. *
  26. *    SEE ALSO
  27. *    dos.library/PrintFault(), ErrorHandle()
  28. *
  29. *************************************************************************/
  30.  
  31. void PError(LONG ErrorCode, const char *String)
  32.  
  33. {
  34.   BPTR OldOutput;
  35.  
  36.   if (!ErrorCode)
  37.     {
  38.       ErrorCode=IoErr();
  39.     }
  40.   OldOutput=SelectOutput(ErrorHandle());
  41.   Flush(OldOutput);
  42.   PrintFault(ErrorCode,(char *)String);
  43.   SelectOutput(OldOutput);
  44. }
  45.